bitkeeper revision 1.1236.1.118 (42417279HPSjyqvMU1nR51tWeAILpw)
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 23 Mar 2005 13:43:21 +0000 (13:43 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 23 Mar 2005 13:43:21 +0000 (13:43 +0000)
Fix x86/64 build.
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/domain.c
xen/arch/x86/traps.c

index db2efe8a86608f8fd3b40ea9d4b546a4d1395f56..906da39dea411fda5ca2b2e8404eec2f31439dc8 100644 (file)
@@ -733,7 +733,9 @@ long do_switch_to_user(void)
 
 void context_switch(struct exec_domain *prev_p, struct exec_domain *next_p)
 {
+#ifdef __i386__
     struct tss_struct *tss = init_tss + smp_processor_id();
+#endif
     execution_context_t *stack_ec = get_execution_context();
 
     __cli();
index d5ef2052f9a6556bd9f2d4498cd15126dd9285c3..f06e9991edb33a21238766dc28b65942ec852292 100644 (file)
@@ -385,12 +385,27 @@ static inline int guest_io_okay(
     struct exec_domain *ed, struct xen_regs *regs)
 {
     u16 x;
+#if defined(__x86_64__)
+    /* If in user mode, switch to kernel mode just to read I/O bitmap. */
+    extern void toggle_guest_mode(struct exec_domain *);
+    int user_mode = !(ed->arch.flags & TF_kernel_mode);
+#define TOGGLE_MODE() if ( user_mode ) toggle_guest_mode(ed)
+#elif defined(__i386__)
+#define TOGGLE_MODE() ((void)0)
+#endif
+
     if ( ed->arch.iopl >= (KERNEL_MODE(ed, regs) ? 1 : 3) )
         return 1;
-    if ( (ed->arch.iobmp_limit > (port + bytes)) &&
-         (__get_user(x, (u16 *)(ed->arch.iobmp+(port>>3))) == 0) &&
-         ((x & (((1<<bytes)-1) << (port&7))) == 0) )
-        return 1;
+
+    if ( ed->arch.iobmp_limit > (port + bytes) )
+    {
+        TOGGLE_MODE();
+        __get_user(x, (u16 *)(ed->arch.iobmp+(port>>3)));
+        TOGGLE_MODE();
+        if ( (x & (((1<<bytes)-1) << (port&7))) == 0 )
+            return 1;
+    }
+
     return 0;
 }
 
@@ -401,14 +416,17 @@ static inline int admin_io_okay(
 {
     struct domain *d = ed->domain;
     u16 x;
+
     if ( IS_PRIV(d) || (d->arch.max_iopl >= (KERNEL_MODE(ed, regs) ? 1 : 3)) )
         return 1;
+
     if ( d->arch.iobmp_mask != NULL )
     {
         x = *(u16 *)(d->arch.iobmp_mask + (port >> 3));
         if ( (x & (((1<<bytes)-1) << (port&7))) == 0 )
             return 1;
     }
+
     return 0;
 }